﻿function Trim(TrimString) {
    var tempObj;
    if (TrimString) { tempObj = TrimString; TrimString = tempObj.value; }
    if (TrimString == "undefined" || TrimString == null) return null;
    if (TrimString.length == 0) TrimString = "";
    else {
        var Lcont = 0, TempStrArray = TrimString.split(" "), Rcont = TempStrArray.length - 1;
        while (TempStrArray[Lcont] == "") Lcont++; while (TempStrArray[Rcont] == "") Rcont--;
        if (Rcont < Lcont) TrimString = ""; else
            for (TrimString = TempStrArray[Lcont], Lcont++; Lcont <= Rcont; Lcont++) TrimString += " " + TempStrArray[Lcont];
        var re = /\'|/g;
        TrimString = TrimString.replace(re, "");
    }
    if (tempObj && TrimString != "undefined" && TrimString != null)
    { tempObj.value = TrimString; return tempObj }
    else return TrimString;
}

function ckNullValue(cntrlsID,lblerr) {
    alert('selvaa');
    var rval = true;
    var objFocus;
    var ErrorMsg = "";

    if (document.getElementById(cntrlsID).value == "") {
        ErrorMsg = "Fields marked with (*) cannot be left blank";
        objFocus = document.getElementById(cntrlsID);
        rval = false;
    }

    if (rval == false) {
        document.getElementById().innerHTML = ErrorMsg;
        objFocus.focus();
    }
    return rval;
}



function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}
